/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
<template>
  <m-popover ref="popover" :ok-text="item && item.name ? $t('Edit') : $t('Submit')" @ok="_ok" @close="close">
    <template slot="content">
      <div style="padding:0 20px;">
        <el-form ref="myform" :model="form"  size="mini" label-position="right" label-width="100px">
          <el-form-item label="申请状态" prop="status">
            <el-radio v-model="form.status" :label="1">申请成功</el-radio>
            <el-radio v-model="form.status" :label="2">申请失败</el-radio>
          </el-form-item>
          <el-form-item v-if="form.status===1" label="超算账户" prop="account" :rules="[{required:true,message:'请输入超算账户'}]">
            <el-input  placeholder="请输入超算账户"></el-input>
          </el-form-item>
          <el-form-item label="备注" prop="auditRemark">
            <el-input type="textarea" placeholder="请输入备注"></el-input>
          </el-form-item>
        </el-form>
      </div>
    </template>
  </m-popover>
</template>
<script>
  import store from '@/conf/home/store'
  import mPopover from '@/module/components/popup/popover'
  export default {
    data () {
      return {
        store,
        routeList: [],
        form: {
          status: 1
        }
      }
    },
    props: {
      item: Object
    },
    methods: {
      async _ok () {
        this.$refs.myform.validate(valid => {
          if (valid) {
            this.$message.success('审核成功')
            this.close()
          }
        })
      },

      close () {
        this.$emit('close')
        setTimeout(() => {
          this.$refs.myform.resetFields()
          this.$refs.myform.clearValidate()
        }, 800)
      }
    },
    watch: {
      item: {
        handler (val, oldVal) {

        },
        deep: true
      }
    },
    created () {
      if (this.item) {
        this.form = Object.assign({}, this.form, this.item)
      }
      this.getRouteListPaging({ pageSize: 1000, pageNum: 1 }).then(res => {
        if (res.code === 200) {
          this.routeList = res.rows
        }
      })
    },
    mounted () {
    },
    components: { mPopover }
  }
</script>
